# Maintainer: Jan de Groot <jgc@archlinux.org>

pkgname=libpwquality
pkgver=1.4.5
pkgrel=2
pkgdesc="Library for password quality checking and generating random passwords"
arch=('x86_64')
url="https://github.com/libpwquality/libpwquality"
license=('GPL')
depends=('cracklib' 'pam')
optdepends=('python: Python bindings')
makedepends=('python')
backup=('etc/security/pwquality.conf')
source=(https://github.com/libpwquality/libpwquality/releases/download/$pkgname-$pkgver/$pkgname-$pkgver.tar.bz2)
md5sums=('6b70e355269aef0b9ddb2b9d17936f21')

prepare() {
  cd $pkgname-$pkgver
  sed '/mr_IN/d' -i po/LINGUAS
}

build() {
  cd $pkgname-$pkgver
  ./configure --prefix=/usr \
    --sysconfdir=/etc \
    --localstatedir=/var \
    --with-python-binary=python3
  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool
  make
}

package() {
  cd $pkgname-$pkgver
  make DESTDIR="$pkgdir" install
  install -m755 -d "$pkgdir"/etc/security/pwquality.conf.d
}
